import { http } from "@/utils/http.js";

// 库存
export const appStockListQuery = (data) => {
  return http.request({
    method: "GET",
    url: "app/stock/query",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存
export const appOrderCreate = (data) => {
  return http.request({
    method: "POST",
    url: "app/order/create",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存
export const appOrderUpdate = (data) => {
  return http.request({
    method: "POST",
    url: "app/order/update",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存
export const appProductNoCode = (data) => {
  return http.request({
    method: "GET",
    url: "app/product/noCode",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 支付
export const appPayCreate = (data) => {
  return http.request({
    method: "POST",
    url: "app/pay/create",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存
export const appPayResult = (data) => {
  return http.request({
    method: "GET",
    url: "app/pay/result",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存
export const appOrderQuery = (data) => {
  return http.request({
    method: "post",
    url: "app/order/query",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 商品详情
export const appOrderDetail = (data) => {
  return http.request({
    method: "GET",
    url: "app/order/detail",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 商品详情
export const getProductByBarCode = (data) => {
  return http.request({
    method: "GET",
    url: "app/product/getByBarCode",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存报损
export const getDamageReason = (data) => {
  return http.request({
    method: "GET",
    url: "app/stock/adjust/damage/reason",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存报损
export const getDamageCreate = (data) => {
  return http.request({
    method: "post",
    url: "app/stock/adjust/damage/create",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存报损
export const getAdjustDamageQuery = (data) => {
  return http.request({
    method: "GET",
    url: "app/stock/adjust/damage/query",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存报损详情
export const getAdjustDamageDetail = (data) => {
  return http.request({
    method: "GET",
    url: "app/stock/adjust/damage/detail",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存报损
export const getApprovePass = (data) => {
  return http.request({
    method: "post",
    url: "/app/stock/adjust/damage/approve/pass",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 库存报损
export const getApproveRefuse = (data) => {
  return http.request({
    method: "post",
    url: "/app/stock/adjust/damage/approve/refuse",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};
// 查询退款金额
export const getOrderRefundCalc = (data) => {
  return http.request({
    method: "post",
    url: "/app/order/refund/calc",
    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 退款
export const getPayRefund = (data) => {
  return http.request({
    method: "post",
    url: "/app/pay/refund",
    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};
